package org.biubiu0002.baiblog.core.config;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @Author: biubiu0002
 * @Date: 2022-05-07 22:29
 **/
@Component
public class WebAppConfigurer implements WebMvcConfigurer {

    @Resource
    private AuthenticationInterceptor authenticationInterceptor;

    @Resource
    private PermissionInterceptor permissionInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authenticationInterceptor);
        registry.addInterceptor(permissionInterceptor)
                .addPathPatterns("/**");

    }

    //权限拦截器和跨域拦截器冲突，要先配跨域，所以用跨域过滤器

}
